fix: resolve failing tests across api and shared packages#42
Open
stooit wants to merge 1 commit into
Open
Conversation
- import badRequest in users route (was ReferenceError -> 500 on bad input)
- fix auth middleware method case-sensitivity ('post' -> 'POST') so POST is public
- implement paginate() utility with correct edge-case handling
- reconcile shared User type field name (userName -> username) across packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and the code-level type errors in the monorepo. 22/22 tests pass. No test files modified, no dependencies added.
Fixes
api/src/routes/users.ts—badRequestwas called but never imported, causing aReferenceError(500 instead of 400 on missing fields). Added the missing import.api/src/middleware/auth.ts— public-methods list contained lowercase"post", which never matched Hono's uppercasec.req.method, soPOST /userswrongly required a token (401 instead of 201). Corrected to"POST".shared/src/utils/pagination.ts— implemented thepaginate<T>()stub: correct page slicing, partial last page,total/totalPages,page/pageSizefields, and empty/out-of-range handling.shared/src/types.ts— reconciled inconsistent field name across thesharedandapipackages.Verification
bun test→ 22 pass / 0 fail.tsc --noEmit: errors reduced from 33 (onmain) → 8. The remaining 8 are pre-existing environment-config issues (bun:testmodule andprocessglobal untyped — nobun-types/@types/nodeincompilerOptions.types). Resolving them would require adding dependencies, which the task explicitly forbids. None relate to the failing tests.Assumptions
process/bun:testtsc errors were left as-is.main(33 baseline errors), so none were introduced by this change.Review
Independently reviewed (
reviewsubagent): APPROVE — auth fix introduces no bypass risk, pagination edge cases correct, type reconciliation consistent across packages.